package com.etl.task.basic;

import com.etl.extract.ScheduleTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * 测试延迟任务
 *
 * @author: chenfenghai
 * @version: 1.0
 * @date: 2020-10-14 17:17
 */
@Slf4j
@Service("TestDelayed")
public class TestDelayedTask extends AbstractTask {

    /**
     * 执行任务抽象方法
     *
     * @param scheduleTask 调度任务
     */
    @Override
    public TaskResult executeTask(ScheduleTask scheduleTask) {
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException ignore) {
        }
        return TaskResult.builder()
                .code(TaskResult.SUCCESS_CODE)
                .handlerNum(0)
                .build();
    }
}
